﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using System.Data.OleDb;

namespace DoAnPM
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        OleDbConnection con;
        private void button1_Click(object sender, EventArgs e)
        {
            string connectionString = "Provider = Microsoft.Jet.OleDb.4.0;" + "Data Source = D:\\QLSV.mdb";
            
            con = new OleDbConnection(connectionString);


            if (con != null)
            {
                con.Open();
                lblState.Text = con.State.ToString();

            }

 
            //con.Dispose();
            //con.Close();
         
            
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void ho_va_ten_Click(object sender, EventArgs e)
        {

        }

        private void Them_Click(object sender, EventArgs e)
        {
            string strSql = "insert into HOCSINH(MaHocSinh,HoTen ) values('" + textMSHS.Text + "','" + textHoTen.Text + "')";

            OleDbCommand command = new OleDbCommand(strSql, con);

            command.ExecuteNonQuery();
        }

        private void textMSHS_TextChanged(object sender, EventArgs e)
        {

        }
    }
}
